﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Guava
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ha = new Hashtable();
            ha.Add(1,"小胖");
            ha.Add(2, "爱吃");
            ha.Add(3, "橙子");
            Console.WriteLine("请输入编号：");
            int Id = int.Parse(Console.ReadLine());

            bool flag= ha.ContainsKey(Id);
            if (flag)
            {
                Console.WriteLine("你查找的为:{0}",ha[Id].ToString());
            }
            else
            {
                Console.WriteLine("您查找的数据错误！！");
            }

            Console.WriteLine("所有查询如下:");
            foreach(DictionaryEntry e in ha)
            {
                int key = (int)e.Key;
                string value = e.Value.ToString();
                Console.WriteLine("编号：{0},名字：{1}",key,value);

            }


        }
    }
}
